//https://leetcode.cn/problems/balanced-binary-tree/description/

int heighttree(struct TreeNode* root)
{
    if (root == NULL)
    {
        return 0;
    }
    int left = heighttree(root->left);
    int right = heighttree(root->right);

    return left > right ? left + 1 : right + 1;
}
bool isBalanced(struct TreeNode* root) {
    if (root == NULL)
    {
        return true;
    }
    else
    {
        return abs(heighttree(root->left) - heighttree(root->right)) <= 1 && isBalanced(root->left) && isBalanced(root->right);
    }

}